/** 
 * @copyright		all rights reserved.
 * @author			how_fly@yahoo.com
 * @brief			user can initialize, truncate or delete 
 * 					all schemas which support the search system.
 * @version			1.0
 * @date
 * 
 * 
 */

#include "stdio.h"
#include "string.h"
#include "init_all_db.h"
#include "del_all_db.h"
#include "truncate_all_db.h"
#include "myxml/read_conf.h"

int main()
{
	//read configure from conf.xml
	configure conf;
	if(read_conf("./conf.xml", conf)!=0)
	{
		printf("not find conf.xml\n");	
		return -1;
	}
	char choice = ' ';//[2];
	do
	{
		printf("choose which do you want ?\n");
		printf("1 delete all db\n");
		printf("2 init all db\n");
		printf("3 truncate all db\n");
		printf("q quit\n");
		printf("input 1, 2, 3, or q\n");
		scanf("%c", &choice);
		if( choice == '1')
		{
			del_all_db(conf);
		}
		else if( choice == '2')
		{
			init_all_db(conf);
		}
		else if( choice == '3')
		{
			truncate_all_db(conf);
		}
		else if( choice == 'q')
		{
			return 0;
		}
	}while(1);

	return 0;
}
